//
//  BIAppDelegate.m
//  BIProjectModule
//
//  Created by yown on 2022/2/9.
//

#import "BIAppDelegate.h"
#import "BIProjectContext.h"

@implementation BIAppDelegate

#pragma mark - Life Cycle

// 启动
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [[BIProjectContext sharedInstance] launchWithOptions:launchOptions];
    return YES;
}

// 进前台
- (void)applicationWillEnterForeground:(UIApplication *)application {
    [[BIProjectContext sharedInstance] resume];
}

// app结束执行
- (void)applicationWillTerminate:(UIApplication *)application {
    [[BIProjectContext sharedInstance] terminate];
}

//// 注册APNS推送成功的回调
//- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
//    [[BIProjectContext sharedInstance] remoteNotificationsSucceed:deviceToken];
//}
//
//// 接收到远程推送时的调用，不存在UNCenter方法时，该函数全版本执行
//// 1.如果应用程序在后台，则通知到，点击查看，该方法自动执行
//// 2.如果应用程序在前台，则通知到，该方法自动执行
//// 3.如果应用程序被关闭，则通知到，点击查看，先执行didFinish方法，再执行该方法
//// 4.可以开启后台刷新数据的功能
//- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler {
//    [[BIProjectContext sharedInstance] didReceiveRemoteNotification:userInfo];
//    completionHandler(UIBackgroundFetchResultNewData);
//}

#pragma mark - Rotation Screen

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    // 获得当前支持的屏幕方向
    return [[BIProjectContext sharedInstance] supportInterfaceOrientation];
}

@end
